import QtQuick 2.0
import "../components"
Item {
    id: root

    // 显示控制
    property int idx: 0
    property bool showDetails: false

    // 条目
    property int num: 0
    property string expId: ""
    property string expName: "expName"
    property string equName: "equName"
    property string programName: "programName"
    property string code: "code"
    property string kit: "kit"
    property string system: "system"
    property string consume: "consume"
    property string runTime: "runTime"
    property string createTime: "createTime"
    property bool mouseHover: false

    property int colNum: 11

    height: 40*dp
    width: parent.width

    signal released()

    onShowDetailsChanged: {
        layout_line.color = mouseHover ? "#F2F9FF" : "white"
    }

    Rectangle{
        id: layout_line
        height: 39*dp
        width: root.width
        color: "white"
        Row{
            x: 20*dp
            Image{       // 箭头占位
                height: 20*dp
                width: 20*dp
                y: 10*dp
                opacity: 0.7
                source: showDetails ? "qrc:/picture/uparrow.png" : "qrc:/picture/downarrow.png"
            }
            Item{
                height: layout_line.height
                width: layout_line.width / colNum - 40*dp
                Text {
                    text: num
                    font.pixelSize: config.fontsize
                    anchors.centerIn: parent
                    width: parent.width
                    wrapMode: Text.WordWrap
                    horizontalAlignment: TextInput.AlignHCenter
                }
            }Item{
                height: layout_line.height
                width: layout_line.width / colNum
                Text {
                    text: expName
                    font.pixelSize: config.fontsize
                    anchors.centerIn: parent
                    width: parent.width
                    wrapMode: Text.WordWrap
                    horizontalAlignment: TextInput.AlignHCenter
                }
            }Item{
                height: layout_line.height
                width: layout_line.width / colNum
                Text {
                    text: equName
                    font.pixelSize: config.fontsize
                    anchors.centerIn: parent
                    width: parent.width
                    wrapMode: Text.WordWrap
                    horizontalAlignment: TextInput.AlignHCenter
                }
            }Item{
                height: layout_line.height
                width: layout_line.width / colNum
                Text {
                    text: programName
                    font.pixelSize: config.fontsize
                    anchors.centerIn: parent
                    width: parent.width
                    wrapMode: Text.WordWrap
                    horizontalAlignment: TextInput.AlignHCenter
                }
            }Item{
                height: layout_line.height
                width: layout_line.width / colNum
                Text {
                    text: code
                    font.pixelSize: config.fontsize
                    anchors.centerIn: parent
                    width: parent.width
                    wrapMode: Text.WordWrap
                    horizontalAlignment: TextInput.AlignHCenter
                }
            }Item{
                height: layout_line.height
                width: layout_line.width / colNum
                Text {
                    text: kit
                    font.pixelSize: config.fontsize
                    anchors.centerIn: parent
                    width: parent.width
                    wrapMode: Text.WordWrap
                    horizontalAlignment: TextInput.AlignHCenter
                }
            }Item{
                height: layout_line.height
                width: layout_line.width / colNum
                Text {
                    text: system
                    font.pixelSize: config.fontsize
                    anchors.centerIn: parent
                    width: parent.width
                    wrapMode: Text.WordWrap
                    horizontalAlignment: TextInput.AlignHCenter
                }
            }Item{
                height: layout_line.height
                width: layout_line.width / colNum
                Text {
                    text: consume
                    font.pixelSize: config.fontsize
                    anchors.centerIn: parent
                    width: parent.width
                    wrapMode: Text.WordWrap
                    horizontalAlignment: TextInput.AlignHCenter
                }
            }Item{
                height: layout_line.height
                width: layout_line.width / colNum
                Text {
                    text: runTime
                    font.pixelSize: config.fontsize
                    anchors.centerIn: parent
                    width: parent.width
                    wrapMode: Text.WordWrap
                    horizontalAlignment: TextInput.AlignHCenter
                }
            }Item{
                height: layout_line.height
                width: layout_line.width / colNum
                Text {
                    text: createTime
                    font.pixelSize: config.fontsize
                    anchors.centerIn: parent
                    width: parent.width
                    wrapMode: Text.WordWrap
                    horizontalAlignment: TextInput.AlignHCenter
                }
            }Item{
                height: layout_line.height
                width: layout_line.width / colNum
                PushButton{
                    title: "数据分析"
                    height: 30*dp
                    width: 60*dp
                    anchors.centerIn: parent
                    text_color: "#1677FF"
                    button_color: "transparent"
                    onReleased: {
                        tabAnalysisId(expId)
                    }
                }
            }
        }
    }

    MouseArea{
        height: parent.height
        width: parent.width - layout_line.width / colNum
        hoverEnabled: true
        onEntered: {
            layout_line.color = "#F2F9FF"
            mouseHover = true
        }
        onExited: {
            layout_line.color = showDetails ? "#F2F9FF" : "white"
            mouseHover = false
        }
        onReleased: {
            root.released()
        }
    }
    CustomBorder{
        bBorderwidth: 1*dp
        borderColor: "#F3F3F3"
    }



}
